package designPattern.structure7.Adapter.chapter8_adapter.test8_2;

public class TreeAndTwoElectricAdapter implements ThreeElectricOutlet, TwoElectricOutlet {
    TwoElectricOutlet twoElectricOutlet;
    ThreeElectricOutlet treeElectricOutlet;

    TreeAndTwoElectricAdapter(TwoElectricOutlet twoOutlet, ThreeElectricOutlet threeOutlet) {
        this.twoElectricOutlet = twoOutlet;
        this.treeElectricOutlet = threeOutlet;
    }

    public void connectElectricCurrent() {
        if (this instanceof ThreeElectricOutlet) {
            twoElectricOutlet.connectElectricCurrent();
        }
        if (this instanceof TwoElectricOutlet) {
            treeElectricOutlet.connectElectricCurrent();
        }
    }
}